﻿using System;

using Injectors.Core;
using System.IO;

namespace Injectors
{
	class Program
	{
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Console.WriteLine(System.String)"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "filepath")]
		static void Main(string[] args)
		{
			if (args != null && args.Length > 0)
			{
				if (System.IO.File.Exists(args[0]) == false) throw new FileNotFoundException("first argument must be a valid filename, not found:" + args[0]);
				InjectorRunner.Run(new FileInfo(args[0]));
				if (args.Length > 1 && args[1] == "run")
				{
					var path = System.IO.Path.GetFullPath(args[0]);
					System.Diagnostics.Process.Start(path);
				}
					

			}
			else
			{
				Console.WriteLine("Please provide a filepath to inject into");
				Console.ReadLine();
			}
		}
	}
}